import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '../views/Login/Login.vue'
import Reg from '../views/Reg/Reg.vue'
// 主页
import Home from '../views/Home/Home.vue'
// 主页的儿子
import Welcome from '../views/Home/Welcome.vue'
// 用户信息
import Userinfo from '../views/User/Userinfo.vue'
// 更换头像
import Avatar from '../views/User/Avatar.vue'
// 重置密码
import ArtPwd from '../views/User/ArtPwd.vue'
// 文章管理
import Artcate from '../views/Aritcle/Artcate.vue'
// 发表文章
import ArtList from '../views/Aritcle/ArtList.vue'
Vue.use(VueRouter)

const routes = [
  // { path: '/', redirect: '/login' },
  { path: '/login', component: Login },
  { path: '/reg', component: Reg },
  {
    path: '/',
    component: Home,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: Welcome
      },
      {
        path: 'user-info',
        component: Userinfo
      }, {
        path: 'user-avatar',
        component: Avatar
      },
      {
        path: 'user-pwd',
        component: ArtPwd
      },
      {
        path: 'art-cate',
        component: Artcate
      },
      {
        path: 'art-list',
        component: ArtList
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
